﻿<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:c="clr-namespace:RSSFeedReader.Commands"
        xmlns:res="clr-namespace:RSSFeedReader.Resources"
        xmlns:cusCtrls="clr-namespace:RSSFeedReader.Controls"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        x:Class="RSSFeedReader.Views.AddNewFeedView"
        WindowStartupLocation="CenterOwner"
        ResizeMode="NoResize"
        Title="{x:Static res:Strings.AddNewFeedView_Title}"
        ShowInTaskbar="False"
        Height="140"
        Width="450"
        mc:Ignorable="d">

    <Window.Resources>
        <c:CommandReference x:Key="AutoPasteUrlCommandReference"
                            Command="{Binding Path=AutoPasteUrlCommand}" />
    </Window.Resources>

    <Border Opacity="0.85">
        <Border.Background>
            <LinearGradientBrush EndPoint="0.5,1"
                                 StartPoint="0.5,0">
                <GradientStop Color="#FF0A0A0A"
                              Offset="0" />
                <GradientStop Color="#FF404040"
                              Offset="0.995" />
                <GradientStop Color="#FF000000"
                              Offset="0.525" />
                <GradientStop Color="#FF000000"
                              Offset="0.723" />
                <GradientStop Color="#FF000000"
                              Offset="0.286" />
                <GradientStop Color="#FF1A1A1A"
                              Offset="0.848" />
            </LinearGradientBrush>
        </Border.Background>
        <Border BorderThickness="1,1,1,1">
            <Border.Background>
                <LinearGradientBrush EndPoint="0.5,1"
                                     StartPoint="0.5,0">
                    <GradientStop Color="#4CFFFFFF"
                                  Offset="0" />
                    <GradientStop Color="#00FFFFFF"
                                  Offset="1" />
                </LinearGradientBrush>
            </Border.Background>

            <Grid>
                <Grid Background="{x:Null}">
                    <Grid.Resources>
                        <DataTemplate DataType="{x:Type ValidationError}">
                            <TextBlock FontStyle="Italic"
                                       Foreground="Yellow"
                                       HorizontalAlignment="Center"
                                       Margin="0,1"
                                       Text="{Binding Path=ErrorContent}" />
                        </DataTemplate>
                    </Grid.Resources>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="30" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="6" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Label x:Name="_addFeedLabel"
                           Margin="2,4"
                           Content="{x:Static res:Strings.AddNewFeedView_AddFeedLabel}"
                           IsTabStop="False"
                           Foreground="White"
                           FontWeight="Bold" />
                    <cusCtrls:CommandTextBox x:Name="_feedUrlTextBox"
                                             Margin="4,4"
                                             Text="{Binding Path=FeedUrl, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}"
                                             Grid.Column="2"
                                             Command="{Binding Path=AutoPasteUrlCommand}"
                                             Background="#FF000000"
                                             Foreground="#FFFFFFFF">
                        <cusCtrls:CommandTextBox.BorderBrush>
                            <LinearGradientBrush EndPoint="0,20"
                                                 StartPoint="0,0"
                                                 MappingMode="Absolute">
                                <GradientStop Color="#FFDBD79F"
                                              Offset="0" />
                                <GradientStop Color="#FF168BFF"
                                              Offset="1" />
                            </LinearGradientBrush>
                        </cusCtrls:CommandTextBox.BorderBrush>
                    </cusCtrls:CommandTextBox>
                    <ContentPresenter Grid.Column="2"
                                      Grid.Row="1"
                                      Content="{Binding Path=(Validation.Errors).CurrentItem, ElementName=_feedUrlTextBox}" />
                    <Button Margin="4,4,0,0"
                            x:Name="_addButton"
                            Content="{x:Static res:Strings.AddNewFeedView_AddButton}"
                            Command="{Binding Path=AddNewFeedCommand}"
                            IsDefault="True"
                            HorizontalAlignment="Left"
                            Width="105"
                            Grid.Column="2"
                            Grid.Row="2"
                            Template="{DynamicResource GlassButton}"
                            Height="25"
                            Foreground="#FFFFFFFF" />
                    <Button x:Name="_closeButton"
                            Content="{x:Static res:Strings.AddNewFeedView_CloseButton}"
                            Grid.Column="2"
                            HorizontalAlignment="Right"
                            Width="105"
                            Margin="0,4,4,0"
                            Grid.Row="2"
                            Template="{DynamicResource GlassButton}"
                            Height="25"
                            Foreground="#FFFFFFFF"
                            IsCancel="True" />
                </Grid>
            </Grid>
        </Border>
    </Border>
</Window>
